<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ad_plan', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('计划组');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->string('name', 64)->comment('计划名称')->default('');
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->integer('channel')->comment('渠道id')->unsigned()->default(0);
            $table->integer('group_id')->comment('计划组id')->unsigned()->default(0);
            $table->integer('media_id')->comment('媒体id')->unsigned()->default(0);
            $table->integer('media_docking_id')->comment('媒体对接id')->unsigned()->default(0);
            $table->integer('media_user_id')->comment('媒体账号id')->unsigned()->default(0);
            $table->integer('creater_id')->comment('创建者id')->unsigned()->default(0);
            $table->integer('access_type')->comment('上报方式 1api 2sdk')->unsigned()->default(0);
            $table->string('creater', 64)->comment('创建者名称')->default('');

            $table->index('name');
            $table->index('game_id');
            $table->index('channel');
            $table->index('group_id');
            $table->index('media_id');
            $table->index('media_docking_id');
            $table->index('media_user_id');
            $table->index('creater_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ad_plan');
    }
};
